<%--
  Created by IntelliJ IDEA.
  User: 企鹅劳劳
  Date: 2023/6/6
  Time: 2:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>Title</title>
  <style>
    * {margin: 0;padding: 0;}

    html {height: 100%;}

    body { height: 100%;}

    .container {
      height: 100%;
      background-color: antiquewhite;
    }

    .big {
      background-image: linear-gradient(to right, #a9c4f2, rgb(173, 173, 173));
      width: 400px;
      height: 550px;
      border-radius: 50px;
      padding: 0 50px;
      position: relative;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
    }

    .header {
      font-size: 50px;
      font-weight: 800;
      text-align: center;
      line-height: 120px;
    }

    .input-item {
      display: block;
      width: 100%;
      margin-bottom: 20px;
      border: 0;
      padding: 10px;
      border-bottom: 1px solid rgb(128, 125, 125);
      font-size: 15px;
      outline: none;
    }


    .login {
      text-align: center;
      padding: 10px;
      width: 100%;
      margin-top: 25px;
      background-color: cornflowerblue;
      color: white;
    }

    .msg {
      text-align: center;
      line-height: 88px;
    }

    a {
      text-decoration-line: none;
      color: cornflowerblue;
    }
  </style>
</head>
<body>
<div class="container">
  <div class="big">
    <div style="display: none" id="bookExists"><%=request.getAttribute("bookExists")%></div>
    <div class="header">开展一个新的书本的讨论</div>
    <form id="form" class="form-wrapper" method="post" action="/addBook">
      <input type="text" id="bookName" name="bookName" placeholder="请输入书名" class="input-item">
      <input type="text" id="bookType" name="bookType" placeholder="请输入书本类型" class="input-item">
      <input type="text" id="author" name="author" placeholder="请输入作者名" class="input-item">
      <%--                    <input type="submit" class="login" value="点击注册" onclick="regist()">--%>
    </form>
    <button class="login" onclick="carryOut()">开展 </button>
    <div class="msg">
      仍不清楚？
      <a href="BookList"> 放弃开展</a>
    </div>
  </div>
</div>
</body>
</html>
<script>
    window.onload=function (){
        var a=document.getElementById('bookExists');
        if(a.innerText=="书本已存在"){
          alert("书本已存在")
        }
    }
    carryOut=function (){
      var bookName=document.getElementById('bookName').value;
      var bookType=document.getElementById('bookType').value;
      var author=document.getElementById('author').value;
      if(bookName==null||bookType==null||author==null){
        alert("请补全信息")
      }
      else{
        document.getElementById('form').submit();
      }
    }

</script>
